import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
import _isString from "lodash/isString";

/**
 * FieldSwitch.js
 * @date 2018/11/14
 */
import React from 'react';
import { Form, Input } from 'antd';
// import intl from 'utils/intl';
import { attributeNameProp, attributeTypeProp, attributeValueProp } from "../../config";
import DataType from "../../DataType";

var FieldSwitch = /*#__PURE__*/function (_React$Component) {
  _inherits(FieldSwitch, _React$Component);

  var _super = _createSuper(FieldSwitch);

  function FieldSwitch() {
    _classCallCheck(this, FieldSwitch);

    return _super.apply(this, arguments);
  }

  _createClass(FieldSwitch, [{
    key: "render",
    value: function render() {
      var _this$props = this.props,
          form = _this$props.form,
          _this$props$propValue = _this$props.propValues,
          propValues = _this$props$propValue === void 0 ? {} : _this$props$propValue;
      return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Form.Item, {
        key: "checkedChildren",
        label: "\u5F00\u65F6\u663E\u793A\u503C"
      }, form.getFieldDecorator('checkedChildren', {
        initialValue: propValues.checkedChildren
      })( /*#__PURE__*/React.createElement(Input, null))), /*#__PURE__*/React.createElement(Form.Item, {
        key: "unCheckedChildren",
        label: "\u5173\u65F6\u663E\u793A\u503C"
      }, form.getFieldDecorator('unCheckedChildren', {
        initialValue: propValues.unCheckedChildren
      })( /*#__PURE__*/React.createElement(Input, null))));
    }
  }]);

  return FieldSwitch;
}(React.Component);

export { FieldSwitch as default };
export function getConfigOfPropValues(propValues) {
  var newConfig = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];

  if (_isString(propValues.checkedChildren)) {
    var _newConfig$push;

    newConfig.push((_newConfig$push = {}, _defineProperty(_newConfig$push, attributeNameProp, 'checkedChildren'), _defineProperty(_newConfig$push, attributeValueProp, propValues.checkedChildren), _defineProperty(_newConfig$push, attributeTypeProp, DataType.String), _newConfig$push));
  }

  if (_isString(propValues.unCheckedChildren)) {
    var _newConfig$push2;

    newConfig.push((_newConfig$push2 = {}, _defineProperty(_newConfig$push2, attributeNameProp, 'unCheckedChildren'), _defineProperty(_newConfig$push2, attributeValueProp, propValues.unCheckedChildren), _defineProperty(_newConfig$push2, attributeTypeProp, DataType.String), _newConfig$push2));
  }

  return newConfig;
}
export var lifeUpgrade = [];
FieldSwitch.getConfigOfPropValues = getConfigOfPropValues;
FieldSwitch.lifeUpgrade = lifeUpgrade;